<?php
// $Id: NamespaceRegistry.interface.php 73 2007-02-12 03:45:43Z tswicegood $
/**
 * This file contains {@link NodeIterator} which is part of the PHP Content 
 * Repository (phpCR), a derivative of the Java Content Repository JSR-170, and 
 * is licensed under the Apache License, Version 2.0.
 *
 * This file is based on the code created for
 * {@link http://www.jcp.org/en/jsr/detail?id=170 JSR-170}
 *
 * @author Travis Swicegood <travis@domain51.net>
 * @copyright PHP Code Copyright &copy; 2004-2005, Domain51, United States
 * @copyright Original Java and Documentation 
 *  Copyright &copy; 2002-2004, Day Management AG, Switerland
 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, 
 *      Version 2.0
 * @package phpContentRepository
 */

/**
 * Load the {@link phpCR} library file(s)
 */ 
require_once(dirname(__FILE__) . '/phpCR.library.php');


/**
 * The {@link Item} is the base interface of {@link Node} and {@link Property}.
 *
 * @author PHP - Travis Swicegood <travis@domain51.net>
 * @copyright Copyright &copy; 2004-2005, Domain51
 * @package phpContentRepository
 */
interface NamespaceRegistry 
{
   /**
    * Set a mapping from prefix to URI. 
    *
    * To remove an existing mapping, set its prefix to NULL.
    *
    * Mappings are one-to-one: remapping an existing URI to a new prefix will 
    * erase the old prefix. Similarly, remapping an existing prefix to a new 
    * URI will erase the old URI. 
    *
    * @param string
    *   The prefix to be mapped
    * @param string
    *   The URI to be mapped
    *
    * @throws {@link NamespaceException}
    *   If an attempt is made to change or delete a built-in mapping (jcr, nt,
    *   mix, pt, sv, phpcr).  An implementation may similarly prevent the 
    *   removal or alteration of additional implementation-specific, built-in
    *   namespaces.
    * @throws {@link RepositoryException}
    *   If another error occurs
    */
    public function setMapping($prefix, $uri);
    
    
   /**
    * Returns an array holding all currently registered prefixes.
    *
    * @return array
    */
    public function getPrefixes();
    
    
   /**
    * Returns an array holding all currently registered URIs.
    *
    * @return a string array
    */
    public function getURIs();
    
    
   /**
    * Returns the URI to which the given $prefix is mapped.
    *
    * @param string
    * @return string
    *
    * @throws {@link NamespaceException}
    *   When?
    * @throws {@link RepositoryException}
    *   If another error occurs    */
    public function getURI($prefix);
    
    
   /**
    * Returns the prefix to which the given $uri is mapped.
    *
    * @param string
    * @return string
    *
    * @throws {@link NamespaceException}
    *   When?
    * @throws {@link RepositoryException}
    *   If another error occurs
    */
    public function getPrefix($uri);
}

